<template>
	<div> <i class="el-icon-edit">修改地址</i>
		<el-form ref="form" label-width="80px" style="margin-top: 2%;">
			<el-form-item label="昵称">
				<el-input v-model="name"></el-input>
			</el-form-item>
			<el-form-item label="电话">
				<el-input v-model="phone"></el-input>
			</el-form-item>
			<el-form-item label="地址">
				<el-input type="textarea" v-model="addr"></el-input>
			</el-form-item>
		</el-form>
		<el-button @click="doupdateaddr()">确认</el-button>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				name: '',
				phone: '',
				addr: '',
				user: {},
			}
		},
		methods: {
			doupdateaddr() {
				this.user = {
					nickname: this.name,
					addr: this.addr,
					phone: this.phone
				}
				this.$postkv('/api/user/updateShip', this.user).then((resp) => {
					console.log(resp.data.data);
					if (resp.data.data == null) {
						this.$message({
							showClose: true,
							message: '更改成功'
						});
					}
				})
			}
		},
		mounted() {
			this.$get('/api/user/shipInfo').then((resp) => {
				console.log(resp.data.data);
				this.name = resp.data.data.name;
				this.phone = resp.data.data.phone;
				this.addr = resp.data.data.addr;
			});
		}
	}
</script>

<style>
</style>